<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tomcat web socket</title>
<script type="text/javascript">
	var ws = new WebSocket("ws://localhost:8080/tested/wsocket");
	ws.onopen = function() {
	};

	ws.onmessage = function(message) {
		document.getElementById("msgArea").textContent += message.data + "\n";
	};

	function postToServer() {
		ws.send(document.getElementById("msg").value);
		document.getElementById("msg").value = "";
	}

	function closeConnect() {
		ws.close();
	}
</script>
</head>

<body>
	<div>
		<textarea rows="4" cols="100" id="msgArea" readonly></textarea>
	</div>
	<div>
		<input id="msg" type="text" />
		<button type="submit" id="sendButton" onclick="postToServer()">Send</button>
	</div>
</body>
</html>